<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>while循环控制</title>
  </head>
  <body>
    <script>
      function table(options = { tr: 5, td: 3 }) {
        document.write(`
        <table border="1" width="100%">
      `);
        let tr = options.tr;
        while (tr-- != 0) {
          document.write(`<tr>`);
          let td = options.td;
          while (td-- != 0) {
            document.write(`<td>${td}</td>`);
          }
          document.write(`</tr>`);
        }

        document.write(`
        </table>
      `);
      }
      table({ tr: 20, td: 10 });
    </script>
  </body>
</html>
